<?php 
namespace app\sgwy\logic;   
use think\Model;

/**
 * Log逻辑定义
 * Class LogLogic
 * @package admin\logic
 */
class LogLogic extends Model
{
	public $errorMsg=[];  
    
    /*
     * 添加操作日志
     */   
    public function addLog($post){    
 		if(!$post) return false; 
        $addData=[
            'FUNCTION'=>isset($post['func'])?trimall($post['func']):'',
            'Action'=>isset($post['action'])?trimall($post['action']):'',  
            'logIp'=>isset($post['ip'])?trimall($post['ip']):getClientIp(),  
            'logString'=>isset($post['content'])?$post['content']:'',   
            'logDate'=>date("Y-m-d",time()),
            'logTime'=>date("H:i:s",time())
        ];           
        $res=db('api_logs')->insert($addData);  
        if(!$res)
            return false; 
        return true; 
        
    }
}